/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package e.z.blog.back.bean;

import java.util.Date;
import org.nutz.dao.entity.annotation.ColDefine;
import org.nutz.dao.entity.annotation.ColType;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Id;
import org.nutz.dao.entity.annotation.Name;
import z.h.w.jar.kit.ED;

/**
 *
 * @author EnzoZhong 用户父类没有数据表
 */
public abstract class AbstractUser {

        @Id
        private Long userId;
        @Name
        @Comment( "电子邮件" )
        private String account;
        @Column
        private String password;
        @Column
        @Comment( "创建时间" )
        private Date buildDate;
        @Column
        @Comment( "状态" )
        private Integer state;
        @Column
        @Comment( "备注" )
        @ColDefine( type = ColType.TEXT )
        private String remark;

        public AbstractUser () {
        }

        /**
         *
         */
        public void encrypt () {
                String md5Password = ED.toInreversiblePassword( this.getPassword() );
                this.setPassword( md5Password );
        }

        /**
         *
         * @return
         */
        public String getAccount () {
                return account;
        }

        /**
         *
         * @param account
         */
        public void setAccount ( String account ) {
                this.account = account;
        }

        /**
         *
         * @return
         */
        public Date getBuildDate () {
                return buildDate;
        }

        /**
         *
         * @param buildDate
         */
        public void setBuildDate ( Date buildDate ) {
                this.buildDate = buildDate;
        }

        /**
         *
         * @return
         */
        public String getPassword () {
                return password;
        }

        /**
         *
         * @param password
         */
        public void setPassword ( String password ) {
                this.password = password;
        }

        /**
         *
         * @return
         */
        public String getRemark () {
                return remark;
        }

        /**
         *
         * @param remark
         */
        public void setRemark ( String remark ) {
                this.remark = remark;
        }

        /**
         *
         * @return
         */
        public Integer getState () {
                return state;
        }

        /**
         *
         * @param state
         */
        public void setState ( Integer state ) {
                this.state = state;
        }

        /**
         *
         * @return
         */
        public Long getUserId () {
                return userId;
        }

        /**
         *
         * @param userId
         */
        public void setUserId ( Long userId ) {
                this.userId = userId;
        }

        @Override
        public boolean equals ( Object obj ) {
                if ( obj == null ) {
                        return false;
                }
                if ( getClass() != obj.getClass() ) {
                        return false;
                }
                final AbstractUser other = ( AbstractUser ) obj;
                if ( this.userId != other.userId && ( this.userId == null || !this.userId.equals( other.userId ) ) ) {
                        return false;
                }
                if ( ( this.account == null ) ? ( other.account != null ) : !this.account.equals( other.account ) ) {
                        return false;
                }
                return true;
        }

        @Override
        public int hashCode () {
                int hash = 5;
                hash = 41 * hash + ( this.userId != null ? this.userId.hashCode() : 0 );
                hash = 41 * hash + ( this.account != null ? this.account.hashCode() : 0 );
                return hash;
        }

        @Override
        public String toString () {
                return "AbstractUser{" + "userId=" + userId + ", account=" + account + ", password=" + password + ", buildDate=" + buildDate + ", state=" + state + ", remark=" + remark + '}';
        }
}
